package cn.school.thoughtworks.section3;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PracticeC {
    Map<String,Integer> createUpdatedCollection(List<String> collectionA, Map<String,List<String>> object) {
        Map<String,Integer> collection3=new HashMap<>();
        List<String> list = object.get("value");
        for(int i= 0;i<collectionA.size();i++){
            String s = collectionA.get(i);
            if(collection3.containsKey(s)){
                Integer integer = collection3.get(s);
                integer+=1;
                collection3.put(s,integer);
            }else{
                collection3.put(s,1);
            }
        }

        for (int i =0;i<list.size();i++){
            String s = list.get(i);
            if(collection3.containsKey(s)) {
                Integer j = collection3.get(s);
                collection3.put(s,j-j/3);
            }
        }


        return collection3;
    }
}
